package com.iot.auth;

/**
 * @author Administrator
 */
public class AuthenticationResponse {
    private boolean success;
    private int code;
    private String message;
    private String deviceId;

    public AuthenticationResponse() {
    }

    public static AuthenticationResponse success(String deviceId) {
        AuthenticationResponse response = new AuthenticationResponse();
        response.success = true;
        response.code = 200;
        response.message = "授权通过";
        response.deviceId = deviceId;
        return response;
    }

    public static AuthenticationResponse error(int code, String message) {
        AuthenticationResponse response = new AuthenticationResponse();
        response.success = false;
        response.code = code;
        response.message = message;
        return response;
    }

    public boolean isSuccess() {
        return this.success;
    }

    public int getCode() {
        return this.code;
    }

    public String getMessage() {
        return this.message;
    }

    public String getDeviceId() {
        return this.deviceId;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public void setDeviceId(String deviceId) {
        this.deviceId = deviceId;
    }

    @Override
    public String toString() {
        return "AuthenticationResponse(success=" + this.isSuccess() + ", code=" + this.getCode() + ", message=" + this.getMessage() + ", deviceId=" + this.getDeviceId() + ")";
    }
}
